/* 全局风格变量 */
:root {
  --primary-color: #4a6fa5;
  --primary-dark: #2c4674;
  --secondary-color: #e9825e;
  --text-color: #333;
  --light-text: #666;
  --background-color: #f5f7fa;
  --card-color: #fff;
  --border-color: #e1e4e8;
  --section-color-1: #f0f4ff;
  --section-color-2: #fff5f0;
  --section-color-3: #f0fff5;
  --section-color-4: #fff0f9;
  --section-color-5: #fffff0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s ease;
  --border-radius: 8px;
}

/* 基本样式 */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-color);
  background-color: var(--background-color);
  min-height: 100vh;
}

.app-header {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.app-header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: var(--primary-color);
  letter-spacing: 2px;
}

.subtitle {
  color: var(--light-text);
  font-size: 1rem;
  font-weight: 300;
}

.content-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

@media (max-width: 900px) {
  .content-container {
    grid-template-columns: 1fr;
  }
  
  .app-header h1 {
    font-size: 2rem;
  }
  
  .subtitle {
    font-size: 0.9rem;
  }
  
  .events-section {
    margin-top: 30px;
  }
}

@media (max-width: 600px) {
  .app-container {
    padding: 15px 10px;
  }
  
  .form-section, 
  .event-card {
    padding: 20px 15px;
  }
  
  .form-group {
    padding: 15px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .form-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .btn-primary, 
  .btn-secondary, 
  .btn-expand, 
  .btn-add {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
  }
  
  .events-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .events-header .btn-add {
    align-self: stretch;
  }
  
  .events-list {
    max-height: none;
  }
  
  .event-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .event-actions {
    align-self: flex-end;
    margin-top: 10px;
  }
  
  .btn-edit, 
  .btn-delete {
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }
}

/* 针对特小屏幕设备的优化 */
@media (max-width: 380px) {
  .app-header h1 {
    font-size: 1.8rem;
  }
  
  .form-section h2,
  .events-header h2 {
    font-size: 1.3rem;
  }
  
  .form-group h3 {
    font-size: 1.1rem;
  }
  
  input, 
  textarea, 
  button {
    font-size: 15px;
  }
  
  label {
    font-size: 15px;
  }
  
  small {
    font-size: 0.75rem;
  }
}

/* 添加触摸设备的特定优化 */
@media (hover: none) {
  /* 增大所有可点击元素的点击区域 */
  .btn-primary, 
  .btn-secondary, 
  .btn-expand, 
  .btn-add {
    padding: 14px 20px;
  }
  
  .btn-edit, 
  .btn-delete {
    min-width: 44px;
    min-height: 44px;
  }
  
  /* 改善表单元素的可用性 */
  input, 
  textarea {
    padding: 14px;
  }
  
  /* 消除悬停效果，改为激活状态效果 */
  .btn-primary:active,
  .btn-secondary:active,
  .btn-add:active {
    transform: scale(0.98);
  }
  
  .event-card:hover {
    transform: none;
  }
  
  .event-card:active {
    background-color: #f9f9f9;
  }
}

/* 安全区域适配 - 针对全面屏手机 */
@supports (padding: max(0px)) {
  .app-container {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}

/* 针对折叠屏/可变尺寸设备的优化 */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  .form-section, 
  .events-section {
    max-height: 80vh;
    overflow-y: auto;
  }
  
  .content-container {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  
  .app-header {
    margin-bottom: 20px;
  }
}

/* 优化表单在移动设备上的间距和尺寸 */
@media (max-width: 600px) {
  .form-field {
    margin-bottom: 15px;
    width: 100%;
    overflow-x: hidden;
  }
  
  .form-group {
    padding: 15px 12px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  
  textarea {
    min-height: 80px;
    padding: 10px;
    font-size: 15px;
  }
  
  .form-section, 
  .event-card {
    padding: 20px 15px;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  
  /* 确保所有容器元素都不会溢出 */
  .app-container,
  .content-container,
  .events-section,
  .form-section {
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
  }
  
  /* 调整事件卡片内容以防止溢出 */
  .event-content {
    width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
  
  .event-section p {
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
  
  /* 改善移动端的焦点状态 */
  input:focus,
  textarea:focus {
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.3);
  }
}

/* 针对特小屏幕进一步优化 */
@media (max-width: 380px) {
  .form-group {
    padding: 12px 10px;
  }
  
  input, 
  textarea {
    padding: 8px;
    font-size: 14px;
  }
  
  .form-field small {
    font-size: 0.7rem;
  }
}

/* 确保所有元素使用border-box盒模型 */
* {
  box-sizing: border-box;
}

/* 表单样式 */
.form-section {
  background-color: var(--card-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 30px;
  transition: var(--transition);
}

.form-section h2 {
  text-align: center;
  margin-bottom: 20px;
  color: var(--primary-color);
  font-size: 1.5rem;
}

.form-group {
  margin-bottom: 30px;
  padding: 20px;
  border-radius: var(--border-radius);
}

/* 各部分专属背景 */
.coordinates-section {
  background-color: var(--section-color-1);
  border-left: 4px solid var(--primary-color);
}

.motivation-section {
  background-color: var(--section-color-2);
  border-left: 4px solid var(--secondary-color);
}

.perspective-section {
  background-color: var(--section-color-3);
  border-left: 4px solid #5ebd73;
}

.value-section {
  background-color: var(--section-color-4);
  border-left: 4px solid #bd5e99;
}

.sensory-section {
  background-color: var(--section-color-5);
  border-left: 4px solid #bdad5e;
}

.form-group h3 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.2rem;
  color: var(--text-color);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.form-field {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-color);
}

.required {
  color: #e74c3c;
}

input,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background-color: white;
  font-size: 16px;
  transition: var(--transition);
  color: var(--text-color);
  box-sizing: border-box;
  max-width: 100%;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.2);
}

small {
  display: block;
  margin-top: 5px;
  color: var(--light-text);
  font-size: 0.8rem;
}

.form-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 30px;
}

/* 按钮样式 */
.btn-primary,
.btn-secondary,
.btn-expand,
.btn-add {
  padding: 12px 24px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
}

.btn-secondary {
  background-color: #e1e4e8;
  color: var(--text-color);
}

.btn-secondary:hover {
  background-color: #d0d4d9;
}

.btn-add {
  background-color: var(--secondary-color);
  color: white;
}

.btn-add:hover {
  background-color: #d77550;
}

.btn-edit,
.btn-delete {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-edit {
  color: var(--primary-color);
}

.btn-edit:hover {
  background-color: rgba(74, 111, 165, 0.1);
}

.btn-delete {
  color: #e74c3c;
}

.btn-delete:hover {
  background-color: rgba(231, 76, 60, 0.1);
}

.btn-expand {
  background: none;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  width: 100%;
  margin-top: 15px;
}

.btn-expand:hover {
  background-color: rgba(74, 111, 165, 0.1);
}

/* 事件列表样式 */
.events-section {
  display: flex;
  flex-direction: column;
}

.events-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.events-header h2 {
  margin: 0;
  color: var(--primary-color);
}

.events-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  max-height: 85vh;
  padding-right: 10px;
}

.event-card {
  background-color: var(--card-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: var(--transition);
}

.event-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.event-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.event-header h3 {
  margin: 0;
  color: var(--primary-color);
  font-size: 1.1rem;
}

.event-actions {
  display: flex;
  gap: 5px;
}

.event-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.event-section h4 {
  font-size: 0.9rem;
  margin: 0 0 5px 0;
  color: var(--light-text);
}

.event-section p {
  margin: 0;
  line-height: 1.5;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--card-color);
  border-radius: var(--border-radius);
  padding: 40px;
  text-align: center;
  color: var(--light-text);
  border: 2px dashed var(--border-color);
  height: 200px;
}

/* 事件操作区域样式 */
.events-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .events-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .events-actions button {
    width: 100%;
  }
}

/* 生成回忆录按钮样式 */
.btn-generate {
  background-color: #6a5acd;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-generate:hover {
  background-color: #5a4abD;
}

.btn-generate:disabled {
  background-color: #b1aad0;
  cursor: not-allowed;
}

.event-count {
  background-color: white;
  color: #6a5acd;
  font-size: 0.75rem;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 加载指示器样式 */
.generating-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-top: 20px;
  text-align: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(106, 90, 205, 0.2);
  border-left-color: #6a5acd;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 回忆录展示区域样式 */
.memoir-section {
  margin-top: 40px;
  background-color: var(--card-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 30px;
  width: 100%;
}

.memoir-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.memoir-header h2 {
  margin: 0;
  color: var(--primary-color);
}

.memoir-content {
  line-height: 1.8;
  font-size: 18px;
  color: var(--text-color);
  font-weight: 400;
  letter-spacing: 0.3px;
  padding: 15px;
  background-color: #fdfdfd;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary-color);
  white-space: pre-line;
}

/* Markdown预览样式 */
.markdown-preview h1 {
  font-size: 2rem;
  color: var(--primary-color);
  margin: 1.5em 0 0.8em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border-color);
}

.markdown-preview h2 {
  font-size: 1.5rem;
  color: var(--primary-color);
  margin: 1.3em 0 0.7em;
}

.markdown-preview strong {
  color: var(--primary-dark);
  font-weight: 600;
}

.markdown-preview p {
  margin: 0.8em 0;
}

@media (max-width: 600px) {
  .memoir-section {
    padding: 20px 15px;
  }
  
  .markdown-preview h1 {
    font-size: 1.6rem;
  }
  
  .markdown-preview h2 {
    font-size: 1.3rem;
  }
}

/* 添加开发模式标记样式 */
.dev-mode-indicator {
  background-color: #ff6b6b;
  color: white;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 4px;
  position: absolute;
  top: 10px;
  right: 10px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

@media (max-width: 600px) {
  .dev-mode-indicator {
    top: 5px;
    right: 5px;
    font-size: 0.7rem;
    padding: 3px 6px;
  }
}    